package tcl.loan.system.shiro.tag;

import cn.org.rapid_framework.freemarker.directive.BlockDirective;
import cn.org.rapid_framework.freemarker.directive.ExtendsDirective;
import cn.org.rapid_framework.freemarker.directive.OverrideDirective;
import cn.org.rapid_framework.freemarker.directive.SuperDirective;
import freemarker.template.TemplateException;
import org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer;

import java.io.IOException;

/**
 * Created by Administrator on 2016/3/15.
 */
public class ShiroTagFreeMarkerConfigurer extends FreeMarkerConfigurer {
    @Override
    public void afterPropertiesSet() throws IOException, TemplateException {
        super.afterPropertiesSet();
        this.getConfiguration().setSharedVariable("shiro", new ShiroTags(this.getConfiguration().getObjectWrapper()));
        this.getConfiguration().setSharedVariable("block", new BlockDirective());
        this.getConfiguration().setSharedVariable("override", new OverrideDirective());
        this.getConfiguration().setSharedVariable("extends", new ExtendsDirective());
        this.getConfiguration().setSharedVariable("super", new SuperDirective());
    }

}
